{template '_header'}
<link rel="stylesheet" type="text/css" href="../addons/ewei_shopv2/template/mobile/default/static/css/coupon.css?v=2.0.0">
<div class='fui-page fui-page-current coupon-detail-page'>
	<div class="fui-header">
		<div class="fui-header-left">
			<a class="back"></a>
		</div>
		<div class="title">优惠券详情</div>
		<div class="fui-header-right">
			<a href="{php echo mobileUrl('sale/coupon')}" class="external">
				<i class="icon icon-home"></i>
			</a>
		</div>
	</div>
	<div class='fui-content'>
		<div class="coupon-detail">
			<div class="coupon-detail-head {$coupon['color']}">
				<div class="coupon-detail-head-title">
					<h2>{$coupon['couponname']}</h2>
					<p>有效期:{if $coupon['timestr']=='0'}
						永久有效
						{else}
						{if $coupon['timestr']=='1'}
						即{$coupon['gettypestr']}日内 {$coupon['timedays']} 天有效
						{else}
						有效期 {$coupon['timestr']}
						{/if}
						{/if}
						{if !empty($coupon['merchname'])}
						限购[{$coupon['merchname']}]店铺商品
						{/if}</p>
				</div>
				<div class="coupon-detail-head-info">
					<span>{$coupon['title2']}{$coupon['title3']}</span>
					{if $coupon['canget']===false}
						<a href="javascript:void(0);"><p  style="color:#ccc;">已达到{$coupon['gettypestr']}上限</p></a>
					{elseif $pass}
						<a href="javascript:void(0);"  id="btncoupon"><p>立即{$coupon['gettypestr']}</p></a>
					{else}
						<a href="javascript:void(0);"><p>未达到{$coupon['gettypestr']}权限</p></a>
					{/if}
				</div>
				<div class="coupon-detal-bot">
					<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
					<i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i><i></i>
				</div>
			</div>
			<div class="coupon-detail-content">
				<div class="coupon-detail-content-info">
					<div class="coupon-detail-content-info-top">
						<strong>领取限制</strong>
						{if $coupon['islimitlevel']=='1'}
							<p>用户必须达到以下条件之一:</p>
							{if !empty($coupon['limitmemberlevels'])|| $coupon['limitmemberlevels']==='0'}
								<p>		会员:  {$meblvname}
									{loop $level1 $l1}
										{$l1['levelname']}
									{/loop}
								</p>
							{/if}
							{if (!empty($coupon['limitagentlevels']) || $coupon['limitagentlevels']==='0')&&$hascommission}
								<p>		{$leveltitle2}:
									{if in_array("0",$limitagentlevels)}
										{$commissionname}
									{/if}
									{loop $level2 $l2}
									{$l2['levelname']}
									{/loop}
								</p>
							{/if}
							{if (!empty($coupon['limitpartnerlevels']) || $coupon['limitpartnerlevels']==='0')&&$hasglobonus}
								<p>	{$leveltitle3}:  {$globonuname}
									{loop $level3 $l3}
									{$l3['levelname']}
									{/loop}
								</p>
							{/if}
							{if (!empty($coupon['limitaagentlevels']) || $coupon['limitaagentlevels']==='0')&&$hasabonus}
								<p>	{$leveltitle4}:  {$abonuname}
									{loop $level4 $l4}
									{$l4['levelname']}
									{/loop}
								</p>
							{/if}
						{/if}
						{if $coupon['islimitlevel']=='0'}
							<p>无</p>
						{/if}

						<strong>有效期限</strong>
						<p style="font-weight: bold; color:#000;;">{if $coupon['timestr']=='0'}
							永久有效
							{else}
							{if $coupon['timestr']=='1'}
							即{$coupon['gettypestr']}日内 {$coupon['timedays']} 天有效
							{else}
							有效期 {$coupon['timestr']}
							{/if}
							{/if}
							{if !empty($coupon['merchname'])}
							限购[{$coupon['merchname']}]店铺商品
							{/if}</p>
					</div>
					<div class="coupon-detail-content-info-top">
						<strong>使用说明</strong>

						{if empty($coupon['descnoset'])}
							{if empty($coupon['coupontype'])}
								{php echo htmlspecialchars_decode($set['consumedesc'])}
							{else}
								{php echo htmlspecialchars_decode($set['rechargedesc'])}
							{/if}
						{else}
							<p>{$coupon['desc']}</p>
						{/if}
					</div>
					<div class="coupon-detail-content-info-bot">
						<strong>使用限制</strong>

						{if $coupon['coupontype']=='2'}
						<p>本优惠卷只能在收银台中使用</p>
						{/if}

						{if $coupon['limitdiscounttype']=='1'}
							<p>不允许与促销优惠同时使用</p>
						{elseif $coupon['limitdiscounttype']=='2'}
							<p>不允许与会员折扣同时使用</p>
						{elseif $coupon['limitdiscounttype']=='3'}
							<p>不允许与促销优惠和会员折扣同时使用</p>
						{/if}
						{if $coupon['limitgoodtype']=='1'}
						<p>允许以下商品使用:</p>
						<p>
							{loop $goods $g}
						<p>{$g['title']}</p>
							{/loop}

						</p>
						{/if}
						{if $coupon['limitgoodtype']=='1'}
						<p>允许以下商品分类使用:</p>
						<p>
							{loop $category $c}
							{$c['name']}&nbsp;
							{/loop}
						</p>
						{/if}
						{if $coupon['limitgoodtype']=='0'&& $coupon['limitgoodtype']=='0'&&$coupon['limitdiscounttype']=='0'&&$coupon['coupontype']!='2'}
						<p>无</p>
						{/if}
					</div>
				</div>
			</div>
		</div>

		<script language='javascript'>
			require(['biz/sale/coupon/detail'], function (modal) {
				modal.init({coupon: {php echo json_encode($coupon)}});
			});
		</script>
</div>
{template '_footer'}